const requiredHeaders = {
  headers: {
    type: "object",
    properties: {
      token: { type: "string" },
    },
    required: ["token"],
  },
};

exports.getPetDetailSchema = {
  summary: "查询宠物详情",
  tags: ["Pet"],
  ...requiredHeaders,
  params: {
    type: "object",
    properties: {
      id: { type: "string", description: "宠物ID" },
    },
  },
};

exports.addPetSchema = {
  summary: "新建宠物信息",
  tags: ["Pet"],
  body: {
    type: "object",
    required: ["name", "photoUrls", "category", "tags", "status"],
    properties: {
      name: {
        type: "string",
        description: "宠物名称",
      },
      photoUrls: {
        type: "array",
        items: {
          type: "string",
          format: "binary",
        },
        description: "宠物的图片地址，可以多个",
      },
      category: {
        type: "string",
        description: "分类名称",
      },
      tags: {
        type: "array",
        items: { type: "string" },
        description: "标签名称",
      },
      status: {
        type: "string",
        enum: ["available", "pending", "sold"],
        description: "商品状态枚举值。合法值包括：\n1. 'available' - 商品可用，表示商品库存充足，可正常购买。\n2. 'pending' - 商品待定，可能表示商品正在等待审核、打包、运输等流程中。\n3. 'sold' - 商品已售，表示该商品已经被购买，目前无库存可供出售。",
      },
    },
  },
};

exports.putPetSchema = {
  summary: "修改宠物信息",
  tags: ["Pet"],
  params: {
    type: "object",
    properties: {
      id: { type: "string", description: "宠物ID" },
    },
  },
  body: {
    type: "object",
    required: ["name", "photoUrls", "category", "tags", "status"],
    properties: {
      name: {
        type: "string",
        description: "宠物名称",
      },
      photoUrls: {
        type: "array",
        items: { type: "string" },
        description: "宠物的图片地址，支持HTTP和HTTPS协议，可以多个，逗号分隔。",
      },
      category: {
        type: "string",
        description: "分类名称",
      },
      tags: {
        type: "array",
        items: { type: "string" },
        description: "标签名称",
      },
      status: {
        type: "string",
        enum: ["available", "pending", "sold"],
        description: "商品状态枚举值。合法值包括：\n1. 'available' - 商品可用，表示商品库存充足，可正常购买。\n2. 'pending' - 商品待定，可能表示商品正在等待审核、打包、运输等流程中。\n3. 'sold' - 商品已售，表示该商品已经被购买，目前无库存可供出售。",
      },
    },
  },
};

exports.deletePetSchema = {
  summary: "删除宠物信息",
  tags: ["Pet"],
  params: {
    type: "object",
    properties: {
      id: { type: "string", description: "宠物ID" },
    },
  },
};

exports.getPetStatusSchema = {
  summary: "根据状态查询宠物列表",
  tags: ["Pet"],
  querystring: {
    type: "object",
    properties: {
      page: { type: "integer", description: "页码" },
      pageSize: { type: "integer", description: "每页条目数" },
      name: {
        type: "string",
        description: "宠物名称",
      },
      photoUrls: {
        type: "string",
        description: "宠物照片",
      },
      category: {
        type: "string",
        description: "宠物种类",
      },
      tags: {
        type: "string",
        description: "宠物标签",
      },
      status: {
        type: "string",
        enum: ["available", "pending", "sold"],
        description: "商品状态枚举值。合法值包括：\n1. 'available' - 商品可用，表示商品库存充足，可正常购买。\n2. 'pending' - 商品待定，可能表示商品正在等待审核、打包、运输等流程中。\n3. 'sold' - 商品已售，表示该商品已经被购买，目前无库存可供出售。",
      },
    },
  },
};
